﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	mc:Ignorable="d"
	xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:pb="clr-namespace:Spritehand.PhysicsBehaviors;assembly=Spritehand.PhysicsBehaviors"
	x:Class="PinballGame.RightFlipper"
	d:DesignWidth="640" d:DesignHeight="480" Height="200" Width="200">

	<Canvas x:Name="LayoutRoot">
		<Rectangle x:Name="rectRightHolder" CacheMode="BitmapCache" Fill="#FF8A9DD0" Stroke="Black" Height="21" Width="24" Canvas.Left="119" Canvas.Top="18">
			<i:Interaction.Behaviors>
				<pb:PhysicsObjectBehavior IsStatic="True"/>
			</i:Interaction.Behaviors>
		</Rectangle>
		<Canvas x:Name="cnvRightFlipper" CacheMode="BitmapCache" Height="186" Width="201">
			<i:Interaction.Triggers>
				<pb:PhysicsKeyTrigger Key="Right">
					<pb:PhysicsApplyTorqueBehavior TorqueValue="150000"/>
				</pb:PhysicsKeyTrigger>
			</i:Interaction.Triggers>
			<i:Interaction.Behaviors>
				<pb:PhysicsObjectBehavior/>
			</i:Interaction.Behaviors>
			<Path x:Name="pathLeftFlipper" Fill="#FF8AD0C9" Stretch="Fill" Stroke="Black" Height="50" Width="200.5" RenderTransformOrigin="0.5,0.5" UseLayoutRounding="False" Data="M0.5,9.5 C0.5,4.5294371 4.5294371,0.5 9.5,0.5 L191,19 C195.97057,19 200,23.029438 200,28 L199.5,40.5 C199.5,45.470562 195.47057,49.5 190.5,49.5 L9.5,49.5 C4.5294371,49.5 0.5,45.470562 0.5,40.5 z" Canvas.Top="61" Canvas.Left="-26">
				<Path.RenderTransform>
					<TransformGroup>
						<ScaleTransform ScaleX="-1"/>
						<SkewTransform AngleX="0" AngleY="0"/>
						<RotateTransform Angle="-45"/>
						<TranslateTransform/>
					</TransformGroup>
				</Path.RenderTransform>
			</Path>
		</Canvas>
		<Ellipse Fill="#FFD08AB5" Stroke="Black" Height="21" Width="24" Canvas.Left="120" Canvas.Top="18">
			<i:Interaction.Behaviors>
				<pb:PhysicsJointBehavior BodyOne="cnvRightFlipper" BodyTwo="rectRightHolder" CollisionGroup="1" AngleLimitLower="-50" AngleLimitUpper="0" AngleSpringEnabled="True" AngleSpringConstant="10000"/>
			</i:Interaction.Behaviors>
		</Ellipse>
	</Canvas>
</UserControl>